import pymysql

# 建立与MySQL服务器的连接
conn = pymysql.connect(
    host='localhost', 
    port=3306, user='root', 
    password='aaa***1111', 
    database='xhpx'
)
cursor = conn.cursor()

class CURD:
    def select():
        # 执行查询语句
        print('执行查询语句')
        res = []
        sql = "SELECT * FROM user"
        cursor.execute(sql)
        result = cursor.fetchall()
        for row in result:
            # print(row)
            res.append(row)
        return res

        # 关闭连接
        cursor.close()
        conn.close()